<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button id="btn">跳转到其它页面</button>

  <a href="http://www.baidu.com">跳转到百度</a>

  <div class="box">div1</div>
  <div class="box">div2</div>
  <div class="box">div3</div>

  <script>
    // 1. BOM--------------------
    var btn = document.getElementById('btn');
    btn.onclick = function () {
      // BOM
      window.open('https://www.baidu.com', '_blank', 'width=500,height=500');
      // window.location.href = 'https://www.baidu.com';
    }

    // 2. DOM--------------------
    const divs = document.querySelectorAll('.box')
    console.log(divs)

    const div1 = document.querySelector('.box')
    console.log(div1)

  </script>
</body>

</html>